<template>
   
  <div>
    <h1>{{title}}</h1>
    <span class="van-cell--required">{{ filestring }}</span>
  </div>
  <van-button round type="primary" @click="uploadFileFunc">上传文件</van-button>
</template>
 

<script lang="ts" setup> 

import service from '../../localhttp/localService' 

import { onMounted,ref } from 'vue'; 

const title = ref<string>('文件读取');//用于展示图片
 
const filestring = ref<string>('');//用于展示图片
  
onMounted(() => { 
  uploadFileFunc();
})
//点击上传图片
const uploadFileFunc = () => {  
  // fs.readFile('',(err,data)=>{
  //   if(err) throw err;
  //   //console.log('err========>',err);
  //   console.log('data========>',data.toString());

  //   filestring.value =data.toString();
  // })

  service.get('/mock/mytoken.json').then(res => {  
    if(res && res.data && res.data.code == 200){
      filestring.value =res.data.data
    }
    console.log('mykay=====res=======>',res.data.data)
  });
} 

</script>

<style lang="scss" scoped>
.user {
  &-poster {
    width: 100%;
    height: 38vw;
    display: block;
  } 
}
.van-button__content{
  background-color: blue;
}
</style>
